/*
 * @Author: thinkido 4077725@qq.com
 * @Date: 2022-07-07 19:39:43
 * @LastEditors: thinkido 4077725@qq.com
 * @LastEditTime: 2022-07-11 19:42:27
 * @FilePath: \vue3vite-framework\postcss.config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

const postcssPurgecss = require(`@fullhuman/postcss-purgecss`);
const purgecss = postcssPurgecss({
  content: [ `./public/**/*.html`, `./src/**/*.vue` ],
  defaultExtractor (content) {
    const contentWithoutStyleBlocks = content.replace(/<style[^]+?<\/style>/gi, '')
    return contentWithoutStyleBlocks.match(/[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g) || []
  },
  whitelist: [],
  whitelistPatterns: [ /-(leave|enter|appear)(|-(to|from|active))$/, /^(?!(|.*?:)cursor-move).+-move$/, /^router-link(|-exact)-active$/, /data-v-.*/ ],
});
console.log('postcss',process.env.NODE_ENV)

module.exports = {
  "plugins": {
    "autoprefixer": {},
    "postcss-pxtorem": {
      rootValue: 37.5,
      propList: ['*'],
      selectorBlackList: [
        'ant','van-circle__layer'
      ],
      exclude: e=>{
        let regs = [ /node_modules|vant/i,/c-page.scss/]
        let check = regs.some(i=>i.test(e)) ; 
        console.log('postcss-pxtorem exclude:', check , e)
        return check ;
      }
    }
    // ...(process.env.NODE_ENV === "production" ? [purgecss] : []),
  }
}